import type { PageParams, PageResult } from '@/types/global'
import type { BannerItem, GuessItem, HotItem } from '@/types/home'
import { http } from '@/utils/http'

/**
 * 获取任务列表
 */
export const refresh = (data: any) => {
  return http<[]>({
    method: 'GET',
    url: '/api/client/auth/refresh',
    data,
  })
}
/**
 * 收支
 */
export const shouzhigetpage = (data: any) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/shouzhi/get-page',
    data,
  })
}
/**
 * 任务
 */
export const jobgetpage = (data: any) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/job/get-page',
    data,
  })
}
/**
 * 获取任务列表
 */
export const submitgetpage = (data: any) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/job-submit/get-page?id=' + data.id,
  })
}
/**
 * 获取任务详情
 */
export const jobget = (data: any) => {
  return http<[]>({
    method: 'GET',
    url: '/api/client/job-manage/get',
    data,
  })
}
/**
 * 获取订单详情
 */
export const orderget = (data: any) => {
  return http<[]>({
    method: 'GET',
    url: '/api/client/job/get',
    data,
  })
}
/**
 * 获取订单详情
 */
export const submitget = (data: any) => {
  return http<[]>({
    method: 'GET',
    url: '/api/client/job-submit/get',
    data,
  })
}
/**
 * 接取任务
 */
export const jobjoin = (data: any) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/job-manage/join?id=' + data.id,
  })
}

/**
 * 删除图片
 */
export const deleteimg = (data: any) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/file/delete',
    data,
  })
}
/**
 * 删除图片
 */
export const jobsubmit = (data: any) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/job-submit/set-submit',
    data,
  })
}

/**
 * 取消任务
 */
export const closejob = (data: any) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/job/set-close',
    data,
  })
}
/**
 * 获取任务列表
 */
export const getHomeCategoryAPI = (data: any) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/job-manage/get-page',
    data,
  })
}

/**
 * 获取会员基本信息
 */
export const getinfo = () => {
  return http<[]>({
    method: 'GET',
    url: '/api/client/member/get-info',
  })
}
/**
 * 提现状态
 */
export const withdrawalstatus = () => {
  return http<[]>({
    method: 'GET',
    url: '/api/client/withdrawal/get-add-status',
  })
}
/**
 * 提现状态
 */
export const jobstatus = (data: any) => {
  return http<[]>({
    method: 'GET',
    url: '/api/client/job-manage/get-join-status',
    data,
  })
}
/**
 * 提现账户查询
 */
export const getwithdrawal = () => {
  return http<[]>({
    method: 'GET',
    url: '/api/client/withdrawal-account/get-page',
  })
}
/**
 * 删除账户
 */
export const deletewithdrawal = (data: { id: any }) => {
  return http<[]>({
    method: 'DELETE',
    url: '/api/client/withdrawal-account/delete?id=' + data.id,
  })
}
/**
 * 设置默认
 */
export const setdefault = (data: any) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/withdrawal-account/set-enable?id=' + data.id,
  })
}
/**
 * 账户详情
 */
export const getwithdrawalinfo = (data: any) => {
  return http<[]>({
    method: 'GET',
    url: '/api/client/withdrawal-account/get',
    data,
  })
}

type ontixian = {
  accountId: any
  price: any
}
/**
 * 提现申请
 */
export const tiixan = (data: ontixian) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/withdrawal/add',
    data,
  })
}
type onaddwithdrawal = {
  cate: any
  bank: any
  name: any
  account: any
  isDefault: any
  id: any
}
/**
 * 添加提现账户
 */
export const addwithdrawal = (data: onaddwithdrawal) => {
  return http<[]>({
    method: 'POST',
    url: '/api/client/withdrawal-account/add',
    data,
  })
}

/**
 * 更新提现账户
 */
export const updatewithdrawal = (data: onaddwithdrawal) => {
  return http<[]>({
    method: 'PUT',
    url: '/api/client/withdrawal-account/update',
    data,
  })
}
type onupdatename = {
  id: any
  nickName: any
}
/**
 * 修改昵称
 */
export const updatename = (data: onupdatename) => {
  return http<[]>({
    method: 'PUT',
    url: '/api/client/member/update-nick-name',
    data,
  })
}

/**
 * 首页-广告区域-小程序
 * @param distributionSite 广告区域展示位置（投放位置 投放位置，1为首页，2为分类商品页） 默认是1
 */
export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: {
      distributionSite,
    },
  })
}

/**
 * 首页-热门推荐-小程序
 */
export const getHomeHotAPI = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}

/**
 * 猜你喜欢-小程序
 */
export const getHomeGoodsGuessLikeAPI = (data?: PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data,
  })
}

/**
 * 获取七牛云token
 */
export const gettoken = (data:any) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/api/client/file/get-token',
    data
  })
}
